/**
 * @author liaosh
 * @date 2022-10-16 11:42
 */
public class Resume implements Cloneable {
    private String name;
    private String sex;
    private Integer age;

    private WorkExperience work;

    public Resume(String name) {
        this.name = name;
        work = new WorkExperience();
    }

    /**
     * 设置个人信息
     */
    public void setPersonlInfo(String sex, Integer age) {
        this.sex = sex;
        this.age = age;
    }

    public void setWorkExperience(String workDate, String workCompany) {
        work.setWorkDate(workDate);
        work.setWorkCompany(workCompany);
    }

    public void display() {
        System.out.println("姓名：" + name + "，性别：" + sex + "，年龄：" + age);
        System.out.println("上家工作经历：工作时间：" + work.getWorkDate() + "，所在公司：" + work.getWorkCompany());
    }

    /**
     * 浅拷贝
     * @return
     * @throws CloneNotSupportedException
     */
    /*@Override
    protected Object clone() throws CloneNotSupportedException {
        return super.clone();
    }*/

    /**
     * 深拷贝
     * @return
     * @throws CloneNotSupportedException
     */
    @Override
    protected Object clone() throws CloneNotSupportedException {
        Resume resume = (Resume) super.clone();
        resume.work = (WorkExperience) work.clone();
        return resume;
    }
}
